package ltd.smallwang.domain.task.constant;

import com.alibaba.cola.exception.BizException;
import lombok.Getter;

/**
 * @author justd
 * @description 功能描述
 * @since 2024-04-21 20:12
 **/
@Getter
public enum CompleteFlagEnum {
  /**
   * 未完成
   */
  NOT_COMPLETE(0),
  /**
   * 已完成
   */
  COMPLETED(1);

  private final Integer completeFlag;

  CompleteFlagEnum(Integer completeFlag) {
    this.completeFlag = completeFlag;
  }

  public static CompleteFlagEnum init(Integer completeFlag) {
    for (CompleteFlagEnum completeFlagEnum : CompleteFlagEnum.values()) {
      if (completeFlagEnum.getCompleteFlag().equals(completeFlag)) {
        return completeFlagEnum;
      }
    }
    throw new BizException("enum init error");
  }
}
